JSZap: Compressing JavaScript Code

نویسندگان

  • Martin Burtscher
  • Gaurav Sinha
چکیده

JavaScript is widely used in web-based applications, and gigabytes of JavaScript code are transmitted over the Internet every day. Current efforts to compress JavaScript to reduce network delays and server bandwidth requirements rely on syntactic changes to the source code and content encoding using gzip. In this paper, we consider reducing the JavaScript source code to a compressed abstract syntax tree (AST) and transmitting the code in this format. An AST-based representation has a number of benefits including reducing parsing time on the client, fast checking for well-formedness, and, as we show, compression. With JSZAP, we transform the JavaScript source into three streams: AST production rules, identifiers, and literals, each of which is compressed independently. While previous work has compressed Java programs using ASTs for network transmission, no prior work has applied and evaluated these techniques for JavaScript source code, despite the fact that it is by far the most commonly transmitted program representation. We show that in JavaScript the literals and identifiers constitute the majority of the total file size and we describe techniques that compress each stream effectively. On average, compared to gzip we reduce the production, identifier, and literal streams by 30%, 12%, and 4%, respectively. Overall, we reduce total file size by 10% compared to gzip while, at the same time, benefiting the client by moving some of the necessary processing to the server.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Automatic Unit Test Generation and Execution for JavaScript Program through Symbolic Execution

JavaScript is expected to be a programming language of even wider use, considering demands for more interactive web/mobile applications. While reliability of JavaScript code will be of more importance, testing techniques for the language remain insufficient compared to other languages. We propose a technique to automatically generate high-coverage unit tests for JavaScript code. The technique m...

متن کامل

Malicious JavaScript detection using machine learning

JavaScript has become a ubiquitous Web technology that enables interactive and dynamic Web sites. The widespread adoption, along with some of its properties allowing authors to easily obfuscate their code, make JavaScript an interesting venue for malware authors. In this survey paper, we discuss some of the difficulties in dealing with malicious JavaScript code, and go through some recent appro...

متن کامل

SIMD in JavaScript via C++ and Emscripten

Emscripten, Mozilla’s C/C++ to JavaScript compiler, can be used to port existing native C/C++ applications to the Web platform. When paired with a fast JavaScript engine, the applications run at near-native speeds. However, compute intensive C/C++ applications, such as games and media-processing, making use of SIMD intrinsics or gcc style vector code cannot achieve near-native speed, because Ja...

متن کامل

Detection of Javascript Vulnerability At Client Agen

These days, most of companies expanding their business horizon through dynamic web sites based on Web 2.0 concept. The JavaScript is a key choice of web developers to build sophisticated dynamic web 2.0 application such social network site, blogs, e-commerce websites. On the other hand vulnerable JavaScript code is also exploited by the hackers to launch the attacks. Hacker may tamper the JavaS...

متن کامل

Automatic fault localization for client-side JavaScript

JAVASCRIPT is a scripting language that plays a prominent role in web applications today. It is dynamic, loosely typed, asynchronous, and is extensively used to interact with the DOM at runtime. All these characteristics make JAVASCRIPT code error-prone; unfortunately, JAVASCRIPT fault localization remains a tedious and mainly manual task. Despite these challenges, the problem has received very...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2010